﻿var fnCustomAdd = function () {
    if (Y.util.Dom.getViewportHeight() < 400 || Y.util.Dom.getViewportWidth() < 400) {
        SetMaxDWH(YAHOO.example.container.dialog1);
    }
    //debugger
    var formURL = "/ExtendPage/CtrlPage/TreeData.aspx?type=menuRight";
    document.getElementById("EditUIWindow").src = formURL;

    SetMaxDWH(YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();

}


var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    const_EditEntity = "Set_Shortcut";
    document.getElementById("EditUIWindow").src = "AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&fun=edit" + "&id=" + record.getData(const_entityID);
    SetDWH(550, 480, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}





var fnCallBack = function (data) {
    fnRunProc("Usp_Set_Shortcut", parent._currentUserID + "," + data.replace(/,/g, "."), function () {
        alert("设置成功");
        RefreshData();
    });

    //alert(data);
}

//var fnCustomDelete = function () {
//    debugger
//    var recordID = myDataTable.getSelectedRows()[0];
//    var record = myDataTable.getRecord(recordID);
//    var const_CurID = record.getData("ID");
//    SaveUrl = "/Extend/AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=Set_Shortcut&json=" + const_CurID;
//    YAHOO.example.container.dialog3.show();
//}

////删除
//function DeleteData() {
//    if (typeof (fnCustomDeleteData) == "function") {
//        fnCustomDeleteData();
//        return;
//    } else {
//        YAHOO.util.Connect.asyncRequest('POST', SaveUrl, {
//            success: function (res) {
//                try {
//                    var str = res.responseText;

//                    if (str == "1") {
//                        alert("数据删除成功");
//                        var recordID = mDataTable.getSelectedRows()[0];
//                        if (dl.length == 0) {
//                            mDataTable.deleteRow(recordID);
//                        }
//                        else {
//                            for (var i = 0; i < dl.length; i++) {
//                                mDataTable.deleteRow(dl[i]);
//                            }
//                        }
//                    }
//                    else {
//                        alert(str + "\n" + "数据删除失败!");
//                    }
//                }
//                catch (e) {
//                }
//                finally {
//                }
//            },
//            failure: function (error) {
//                alert("数据错误：" + error.statusText);
//            }
//        }, null);
//        YAHOO.example.container.dialog3.hide();
//    }
//}